<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>admin page</title>
    <script>
        function del(){
            return confirm("Delete this record?")
        }
    </script>
</head>
<body>
<h1>admin page</h1>
<%@include file="add.jsp"%>
<table border="1">
    <tr>
        <th>ID</th>
        <th>title</th>
        <th>type</th>
        <th>description</th>
        <th>originalPrice</th>
        <th>currentPrice</th>
        <th>role</th>
        <th colspan="2">OPERATIONS</th>
    </tr>
    <c:forEach var="product" items="${sessionScope.products}">
        <tr>
            <td>${product.id}</td>
            <td>${product.title}</td>
            <td>${product.type}</td>
            <td>${product.description}</td>
            <td>${product.originalPrice}</td>
            <td>${product.currentPrice}</td>
            <td><img src="/pictures/${product.picture}"width="30"></td>
            <td><a href="/product/queryById/${product.id}">EDIT</a> </td>
            <td><a href="/product/removeById/${product.id}" onclick="return del()">REMOVE</a> </td>
        </tr>
    </c:forEach>
    <hr>
</table>
<hr>
<br>
<a href="/user/signOut">返回主页</a>
</body>
</html>
